package com.zhaoyu.article.controller;

import com.zhaoyu.apis.article.ApArticleContentControllerApi;
import com.zhaoyu.article.service.ApArticleContentService;
import com.zhaoyu.model.article.pojos.ApArticleContent;
import com.zhaoyu.model.common.dtos.ResponseResult;
import com.zhaoyu.model.common.enums.AppHttpCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/article_content")
public class ApArticleContentController implements ApArticleContentControllerApi {

    @Autowired
    private ApArticleContentService apArticleContentService;

    @Override
    @PostMapping("/save") // json格式的数据
    public ResponseResult saveApArticleContent(@RequestBody ApArticleContent apArticleContent) {
        boolean b = apArticleContentService.save(apArticleContent);
        if (b){
            return ResponseResult.okResult(AppHttpCodeEnum.SUCCESS);
        }else {
            return ResponseResult.errorResult(AppHttpCodeEnum.SERVER_ERROR);
        }
    }

}